﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:igTilePanel="clr-namespace:Infragistics.Windows.TilePanel;assembly=Infragistics.Windows.TilePanel"
    xmlns:extentions="clr-namespace:FXSStation.Modules.SharedInfrastructureModule.Extentions.TileView;assembly=FXSStation.Modules.SharedInfrastructureModule"
    xmlns:aniScrollViewer="clr-namespace:FXSStation.Modules.SharedInfrastructureModule.Extentions.AnimatedScrollViewer;assembly=FXSStation.Modules.SharedInfrastructureModule"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="BlueThemeBrushes.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <!--Converters-->
    <extentions:BoolToMainStateConverter x:Key="boolToMainState"/>
    <extentions:BoolToSecondaryStateConverter x:Key="boolToSecondaryState"/>

    <!--TileViewExpander button style-->
    <Style x:Key="ExpanderButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Height" Value="15"/>
        <Setter Property="Width" Value="35"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}}" 
                                CornerRadius="0,10,0,0"
                                BorderThickness="2,2,4,2" 
                                Width="{TemplateBinding Width}" 
                                Height="{TemplateBinding Height}" 
                                Name="border">
                        <ContentPresenter Content="Content" Opacity="0"/>
                    </Border>
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverAnimation" RepeatBehavior="2x" FillBehavior="HoldEnd" AutoReverse="True">
                            <ThicknessAnimation Duration="0:0:0.5" Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.BorderThickness)" To="2,4,5,2"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=State, RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}}" Value="Maximized">
                            <Setter TargetName="border" Property="BorderThickness" Value="2,5,2,2"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=State, RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}}" Value="Normal">
                            <Setter TargetName="border" Property="BorderThickness" Value="2,2,2,2"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=State, RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}}" Value="MinimizedExpanded">
                            <Setter TargetName="border" Property="BorderThickness" Value="4,4,2,2"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=State, RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}}" Value="MinimizedCollapsed">
                            <Setter TargetName="border" Property="BorderThickness" Value="4,4,4,4"/>
                        </DataTrigger>

                        <!--<EventTrigger RoutedEvent="Control.MouseEnter">
                            <BeginStoryboard  Storyboard="{StaticResource HoverAnimation}"/>
                        </EventTrigger>-->

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--TileViewPane style-->
    <Style TargetType="{x:Type igTilePanel:WorkspaceItem}">
        <Setter Property="Title" Value="{Binding Content.Title, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Icon" Value="{Binding Content.Icon, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TileViewPaneBorderBrush}"/>
        <Setter Property="Background" Value="{StaticResource TileViewPaneBackground}"/>
        <Setter Property="OpacityMask" Value="{StaticResource TileViewPaneOpacityMaskBrush}"/>
        
        <!--Disabling a pane based on the status of its content-->
        <!--Moved to triggers-->
        <!--<Setter Property="IsEnabled" Value="{Binding Path=Content.IsReady, RelativeSource={RelativeSource Self}}"/>-->

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igTilePanel:WorkspaceItem}">
                        <!--MAIN CONTENT-->
                        <Border Margin="2" Padding="2"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}" 
                                    OpacityMask="{TemplateBinding OpacityMask}"
                                    BorderThickness="2,2,4,4" 
                                    CornerRadius="0,15,15,0">

                            <DockPanel LastChildFill="True">
                                <!--HEADER-->
                                <Border BorderThickness="0,0,0,1" BorderBrush="{TemplateBinding BorderBrush}" DockPanel.Dock="Top">
                                    <Grid DockPanel.Dock="Top">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="10"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="1.5*"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>

                                        <!--ICON-->
                                        <Border Margin="-2,-3,0,0"
                                    HorizontalAlignment="Left" VerticalAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="0,0,2,2" CornerRadius="0,0,5,0">
                                            <Image Width="30" Height="30" Source="{Binding Icon, RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}, UpdateSourceTrigger=PropertyChanged}"/>
                                        </Border>

                                        <!--Title-->
                                        <Border Grid.Column="1" Grid.Row="0" 
                                        HorizontalAlignment="Stretch" 
                                        VerticalAlignment="Stretch" >
                                            <Label Name="PART_Title"
                                                   Foreground="{StaticResource TileViewPaneHeaderForeground}"
                                        HorizontalContentAlignment="Center"
                                        VerticalContentAlignment="Center"
                                        Content="{TemplateBinding Title}">
                                            </Label>

                                        </Border>

                                        <!--Main EXPANDER-->
                                        <ToggleButton IsThreeState="False"
                                        HorizontalAlignment="Right"
                                                  Margin="0,4,4,0" Style="{StaticResource ExpanderButtonStyle}" 
                                          x:Name="expander" IsChecked="{Binding State, 
                                        Converter={StaticResource boolToMainState},
                                        RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}, UpdateSourceTrigger=PropertyChanged}"
                                                  VerticalAlignment="Top" Grid.Column="2" Grid.Row="0"/>

                                        <!--Secondary EXPANDER-->
                                        <ToggleButton Grid.Row="0" x:Name="secondaryExpander" 
                                              IsChecked="{Binding State, 
                                        Converter={StaticResource boolToSecondaryState},
                                        RelativeSource={RelativeSource FindAncestor, AncestorType=igTilePanel:WorkspaceItem}, UpdateSourceTrigger=PropertyChanged}"
                                         VerticalAlignment="Bottom" 
                                                  RenderTransformOrigin="0.5,0.5"
                                                  Height="6" Background="Transparent"
                                                  HorizontalAlignment="Stretch" 
                                                  BorderBrush="{TemplateBinding BorderBrush}" 
                                                  Margin="50,0,50,0"
                                                  Grid.ColumnSpan="3">
                                            <ToggleButton.Template>
                                                <ControlTemplate>
                                                    <Path  x:Name="directionPath"
                                              Fill="{TemplateBinding BorderBrush}" 
                                              Stretch="Fill" 
                                              Data="M0.5,0.5 L490.5,0.5 246.40428,266.1989 246.38419,266.19891 z"/>
                                                </ControlTemplate>
                                            </ToggleButton.Template>
                                        </ToggleButton>
                                    </Grid>

                                </Border>

                                <Grid>
                                    <!--CONTENT-->
                                    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                                        <ContentPresenter Name="PART_Content" Content="{TemplateBinding Content}"/>
                                    </ScrollViewer>

                                    <!--COVER LID-->
                                    <Border
                                       CornerRadius="0,15,15,0" Margin="-2"
                                       BorderBrush="{StaticResource ScrollBarArrowBorderBrush}" 
                                       BorderThickness="3,5,1,3"
                                       Background="{TemplateBinding Background}" 
                                       Opacity="0.7"  
                                       RenderTransformOrigin="0.5,1">
                                        <Border.RenderTransform>
                                            <ScaleTransform ScaleX="1" ScaleY="1" x:Name="coverLid"/>
                                        </Border.RenderTransform>
                                    </Border>
                                </Grid>
                        </DockPanel>
                        </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="State" Value="Maximized">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="secondaryExpander"/>
                            <Setter Property="FontSize" Value="20" TargetName="PART_Title"/>
                            <Setter Property="FontStyle" Value="Italic" TargetName="PART_Title"/>
                            <Setter Property="FontFamily" Value="Arial" TargetName="PART_Title"/>
                        </Trigger>
                        <Trigger Property="State" Value="Normal">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="secondaryExpander"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="secondaryExpander"/>
                            <Setter Property="FontSize" Value="20" TargetName="PART_Title"/>
                            <Setter Property="FontStyle" Value="Italic" TargetName="PART_Title"/>
                            <Setter Property="FontFamily" Value="Arial" TargetName="PART_Title"/>
                        </Trigger>
                        <Trigger Property="State" Value="MinimizedExpanded">
                            <Setter Property="RenderTransform" TargetName="secondaryExpander">
                                <Setter.Value>
                                    <ScaleTransform ScaleY="-1"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        
                        <!--Remove the Cover Lid when the TileViewItem is Ready-->
                        <DataTrigger Binding="{Binding Path=Content.IsReady, RelativeSource={RelativeSource Self}}"
                                     Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard >
                                        <DoubleAnimation To="0" DecelerationRatio="0.6" Duration="0:0:2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="coverLid"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ScrollViewer style-->
    <ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
        <Grid x:Name="Grid" Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Rectangle x:Name="Corner" Grid.Column="1" Grid.Row="1"/>
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Grid.Column="0" Grid.Row="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False"/>
            <ScrollBar Background="{TemplateBinding Background}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_VerticalScrollBar" Style="{DynamicResource ScrollBarStyle}" Grid.Column="1" Grid.Row="0" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="VerticalScrollBar" Margin="3,0,0,0"/>
            <ScrollBar Background="{TemplateBinding Background}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_HorizontalScrollBar" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Style="{DynamicResource ScrollBarStyle}" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="HorizontalScrollBar"/>
        </Grid>
    </ControlTemplate>

    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="Template" Value="{StaticResource ScrollViewerControlTemplate}"/>
    </Style>

    <!--Toggle Button Styles-->
    <Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Path Fill="GhostWhite" Stretch="Fill" Data="M8.2718879,4.3928299 L8.2718879,4.3931414 11.610727,14.802356 4.8878758,14.785737 z" Margin="1.79,2.5,2.5,1.812" Stroke="{StaticResource ScrollBarArrowBorderBrush}" StrokeThickness="2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Width="{TemplateBinding Width}" 
                               Height="{TemplateBinding Height}"
                               Fill="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border CornerRadius="5" 
                                BorderBrush="{StaticResource ScrollBarArrowBorderBrush}" 
                                BorderThickness="1,2,1,2" 
                                Background="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Width="{TemplateBinding Width}" 
                               Height="{TemplateBinding Height}" 
                               Fill="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--ScrollBar style-->
    <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Grid SnapsToDevicePixels="true" x:Name="Bg" 
                              Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                            <RowDefinition Height="0.00001*"/>
                            <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                        </Grid.RowDefinitions>
                        <RepeatButton
                                IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}"
                                Command="{x:Static ScrollBar.LineUpCommand}"
                                Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="UpArrow"
                                Background="{TemplateBinding Background}"/>
                        <Border BorderBrush="{StaticResource ScrollBarArrowBorderBrush}"  BorderThickness="2" CornerRadius="10" Grid.Row="1">
                            <Track IsEnabled="{TemplateBinding IsMouseOver}" x:Name="PART_Track"  IsDirectionReversed="true">
                                <Track.Thumb>
                                    <Thumb Style="{StaticResource ScrollBarThumb}" Background="{StaticResource TileViewPaneBackground}"
                                           Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="VerticalGripper"/>
                                </Track.Thumb>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Style="{StaticResource VerticalScrollBarPageButton}" Command="{x:Static ScrollBar.PageDownCommand}">
                                    </RepeatButton>
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Style="{StaticResource VerticalScrollBarPageButton}" Command="{x:Static ScrollBar.PageUpCommand}">
                                    </RepeatButton>
                                </Track.DecreaseRepeatButton>
                            </Track>
                        </Border>
                            
                        <RepeatButton 
                                IsEnabled="{TemplateBinding IsMouseOver}" 
                                Style="{DynamicResource ScrollBarButton}" Grid.Row="2" 
                                Command="{x:Static ScrollBar.LineDownCommand}" 
                                Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="DownArrow"
                                RenderTransformOrigin="0.5,0.5" Background="{TemplateBinding Background}">
                            <RepeatButton.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1" ScaleY="-1"/>
                                    <SkewTransform AngleX="0" AngleY="0"/>
                                    <RotateTransform Angle="0"/>
                                    <TranslateTransform X="0" Y="0"/>
                                </TransformGroup>
                            </RepeatButton.RenderTransform>
                        </RepeatButton>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="MinWidth" Value="0"/>
                <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ScrollBar}">
                            <Grid SnapsToDevicePixels="true" x:Name="Bg" Background="{TemplateBinding Background}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                    <ColumnDefinition Width="0.00001*"/>
                                    <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                </Grid.ColumnDefinitions>
                                <RepeatButton IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Command="{x:Static ScrollBar.LineLeftCommand}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="LeftArrow" RenderTransformOrigin="0.5,0.5"  Background="{TemplateBinding Background}">
                                    <RepeatButton.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="-90"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </RepeatButton.RenderTransform>
                                </RepeatButton>
                                <Border BorderBrush="{StaticResource ScrollBarArrowBorderBrush}" BorderThickness="2" CornerRadius="10"  Grid.Column="1">

                                    <Track IsEnabled="{TemplateBinding IsMouseOver}" x:Name="PART_Track">
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton Style="{StaticResource VerticalScrollBarPageButton}" Command="{x:Static ScrollBar.PageLeftCommand}"/>
                                        </Track.DecreaseRepeatButton>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton Style="{StaticResource VerticalScrollBarPageButton}" Command="{x:Static ScrollBar.PageRightCommand}"/>
                                        </Track.IncreaseRepeatButton>
                                        <Track.Thumb>
                                            <Thumb Style="{StaticResource ScrollBarThumb}" Background="{StaticResource TileViewPaneBackground}"
                                               Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="HorizontalGripper"/>
                                        </Track.Thumb>
                                    </Track>
                                </Border>
                                <RepeatButton IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Grid.Column="2" Command="{x:Static ScrollBar.LineRightCommand}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="RightArrow" RenderTransformOrigin="0.5,0.5"  Background="{TemplateBinding Background}">
                                    <RepeatButton.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="90"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </RepeatButton.RenderTransform>
                                </RepeatButton>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!--Generic Button Style-->
    <!--<Style TargetType="Button">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="0,2,0,0"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Focusable" Value="False"/>
    </Style>-->

    <!--TREEVIEW STYLES-->
    <PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
    <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Width" Value="16"/>
        <Setter Property="Height" Value="16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Width="16" Height="16" Background="Transparent" Padding="5,5,5,5">
                        <Path x:Name="ExpandPath" Fill="Transparent" Stroke="#FF989898" Data="{StaticResource TreeArrow}">
                            <Path.RenderTransform>
                                <RotateTransform Angle="135" CenterX="3" CenterY="3"/>
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
                            <Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="RenderTransform" TargetName="ExpandPath">
                                <Setter.Value>
                                    <RotateTransform Angle="180" CenterX="3" CenterY="3"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
                            <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style  TargetType="{x:Type TreeViewItem}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Padding" Value="1,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="19" Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <ToggleButton x:Name="Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"/>
                        <Border SnapsToDevicePixels="true" x:Name="Bd" Grid.Column="1" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" x:Name="PART_Header" ContentSource="Header"/>
                        </Border>
                        <ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="false">
                            <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource MouseOverBrush}" />
                        </Trigger>
                        
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Foreground" Value="Black"/>
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource SelectedForegroundBrush}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource MouseOverBrush}"/>
                            <Setter Property="BorderThickness" Value="1"/> 
                        </Trigger>
                        
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--TAB CONTROL STYLES-->
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>
                        <Border 
            Name="Border"
            Margin="0,0,-4,0" 
            Background="{StaticResource TileViewPaneBackground}"
            BorderBrush="{StaticResource TileViewPaneBorderBrush}" 
            BorderThickness="1,1,1,1" 
            CornerRadius="2,12,0,0" >
                            <ContentPresenter x:Name="ContentSite"
              VerticalAlignment="Center"
              HorizontalAlignment="Center"
              ContentSource="Header"
              Margin="12,2,12,2"
              RecognizesAccessKey="True"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource TileViewPaneBorderBrush}" />
                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    
    <DataTemplate x:Key="ColumnHeaderTemplate">
        <Grid Background="{DynamicResource TileViewPaneBackgroundSimple}">
            <TextBlock Text="{Binding}" Background="Transparent" FontWeight="Bold"/>
        </Grid>
    </DataTemplate>
  
    <Style x:Key="ColumnHeaderContainerStyleBase">
        <Setter Property="Control.Background" Value="{DynamicResource TileViewPaneBackgroundSimple}"/>
    </Style>
    
    
    <!--BASE STYLES-->
    <Style TargetType="{x:Type GridView}">
        <Setter Property="ColumnHeaderTemplate" Value="{StaticResource ColumnHeaderTemplate}"/>
        <Setter Property="ColumnHeaderContainerStyle" Value="{StaticResource ColumnHeaderContainerStyleBase}"/>
    </Style>
    <Style TargetType="{x:Type ListView}">
        <Setter Property="Background" Value="Transparent"/>
    </Style>

    <Style TargetType="{x:Type ComboBox}">
        <Setter Property="Background" Value="Transparent"/>
    </Style>
    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Background" Value="Transparent"/>
    </Style>
    <Style TargetType="TabItem" x:Key="TabItemStyleBase">
        <Setter Property="Background" Value="{DynamicResource TileViewPaneBackgroundSimple}"/>
    </Style>
    <Style TargetType="TabItem" x:Key="RssTabItemStyle" BasedOn="{StaticResource TabItemStyleBase}">
        <Setter Property="Header" Value="{Binding Name}"/>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid>
                        <DockPanel>
                            <Image DockPanel.Dock="Left" Source="{Binding Image}"/>
                            <ListView ItemsSource="{Binding Feeds}" DockPanel.Dock="Left" x:Name="rssFeedList" Background="Transparent">
                                <ListView.View>
                                    <GridView ColumnHeaderContainerStyle="{DynamicResource ColumnHeaderContainerStyleBase}" 
                                              ColumnHeaderTemplate="{DynamicResource ColumnHeaderTemplate}">
                                        <GridViewColumn Header="Title" DisplayMemberBinding="{Binding Title}"/>
                                        <GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}"/>
                                    </GridView>
                                </ListView.View>
                            </ListView>
                        </DockPanel>
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>